package exception;

import java.io.*;
import java.util.Scanner;

public class PWDemo1 {
    public static void main(String[] args) {
        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream("大海.txt");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        OutputStreamWriter osw = new OutputStreamWriter(fos);
        BufferedWriter bos = new BufferedWriter(osw);
        PrintWriter  pw = new PrintWriter(bos);
        System.out.println("请输入大海歌词,单独输入exit退出程序");
        Scanner scan = new Scanner(System.in);
        while (true){
            String in = scan.nextLine();
            if ("exit".equals(in)){

                break;
            }
            pw.println(in);
        }
        System.out.println("程序结束");
        pw.close();


    }
}
